package com.julang.check;

import com.julang.check.utils.CommonData;
import com.julang.check.utils.SingnalData;
import com.julang.check.bean.CommonEntity.Language;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
 * @author 赵自强
 * */
@SpringBootApplication(scanBasePackages = "com.julang.check")
@MapperScan("com.julang.check.api.mapper")
public class CheckApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        addLanguages();
        SpringApplication.run(CheckApplication.class, args);
        if (SingnalData.isWindows()) {
            SingnalData.filePath = CommonData.WINDOWSFILEPATH;
        }
    }

    private static void addLanguages() {
        CommonData.LANGUAGES.add(new Language("auto", "自动检测"));
        CommonData.LANGUAGES.add(new Language("zh", "中文"));
        CommonData.LANGUAGES.add(new Language("yue", "粤语"));
        CommonData.LANGUAGES.add(new Language("cht", "繁体中文"));
        CommonData.LANGUAGES.add(new Language("wyw", "文言文"));
        CommonData.LANGUAGES.add(new Language("en", "英语"));
        CommonData.LANGUAGES.add(new Language("jp", "日语"));
        CommonData.LANGUAGES.add(new Language("kor", "韩语"));
        CommonData.LANGUAGES.add(new Language("fra", "法语"));
        CommonData.LANGUAGES.add(new Language("spa", "西班牙语"));
        CommonData.LANGUAGES.add(new Language("th", "泰语"));
        CommonData.LANGUAGES.add(new Language("ara", "阿拉伯语"));
        CommonData.LANGUAGES.add(new Language("ru", "俄语"));
        CommonData.LANGUAGES.add(new Language("pt", "葡萄牙语"));
        CommonData.LANGUAGES.add(new Language("de", "德语"));
        CommonData.LANGUAGES.add(new Language("it", "意大利语"));
        CommonData.LANGUAGES.add(new Language("el", "希腊语"));
        CommonData.LANGUAGES.add(new Language("nl", "荷兰语"));
        CommonData.LANGUAGES.add(new Language("pl", "波兰语"));
        CommonData.LANGUAGES.add(new Language("bul", "保加利亚语"));
        CommonData.LANGUAGES.add(new Language("est", "爱沙尼亚语"));
        CommonData.LANGUAGES.add(new Language("dan", "丹麦语"));
        CommonData.LANGUAGES.add(new Language("fin", "芬兰语"));
        CommonData.LANGUAGES.add(new Language("rom", "罗马尼亚语"));
        CommonData.LANGUAGES.add(new Language("cs", "捷克语"));
        CommonData.LANGUAGES.add(new Language("swe", "瑞典语"));
        CommonData.LANGUAGES.add(new Language("slo", "斯洛文尼亚语"));
        CommonData.LANGUAGES.add(new Language("hu", "匈牙利语"));
        CommonData.LANGUAGES.add(new Language("vie", "越南语"));
        SingnalData.TranslateMode.add(CommonData.LANGUAGES.get(5));
        SingnalData.TranslateMode.add(CommonData.LANGUAGES.get(1));
        SingnalData.TranslateMode.add(CommonData.LANGUAGES.get(5));
    }

    @Override
    protected SpringApplicationBuilder configure(
            SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }
}
